package com.example.test;

import org.junit.Test;

/**
 * @author readpage
 * @create 2022-09-09 8:04
 */
public class Debug {
    @Test
    public void testStringBuffer() {
        String str = null;
        StringBuffer sb = new StringBuffer();
        sb.append(str);

        System.out.println(sb.length());  //4

        System.out.println(sb); //"null"

        StringBuffer sb1 = new StringBuffer(str); //抛异常NullPointerException

        System.out.println(sb1);  //

    }

    @Test
    public void test() {
        String s = "20.01%";
        System.out.println(s.replace("%", ""));
    }
}
